package com.fastshop.backup.dao.impl;

import org.springframework.stereotype.Component;

import com.fastshop.backup.dao.IRoleDao;
import com.fastshop.backup.entity.Role;
import com.fastshop.common.impl.BaseDao;

@Component("roleDao")
public class RoleDao extends BaseDao<Role, String> implements IRoleDao {

	@Override
	public void delete(String id) {
		Role role = super.load(id);
		if (null != role) {
			delete(role);
		}
	}

	@Override
	public void delete(Role role) {
		if (role.isSystem()) {
			return;
		}
		super.delete(role);
	}

	@Override
	public void delete(String[] ids) {
		if (null != ids && 0 < ids.length) {
			for (int i = 0; i < ids.length; i++) {
				this.delete(ids[i]);
			}
		}
	}
}
